package com.ruix.app.network.request;

import com.ruix.app.network.RequestManager;
import com.ruix.app.network.RequestParams;
import com.ruix.app.network.response.RXRequstLog;

import java.util.List;

import okhttp3.Cookie;
import okhttp3.Request;
import okhttp3.RequestBody;

/**
 * Created by hadexs on 2017/4/12.
 */

public abstract class RXRequest {


    protected RequestParams parama;

    public abstract RequestBody buildRequestBody();


    public Request buildRequst() {
//        if (ReleaseConstant.ISDEBUG) {
//            buildRequestLog();
//        }
        Request.Builder builder = new Request.Builder();
        builder.url(parama.getUrl())
                .tag(parama.getPath())
                .headers(RequestManager.commonHeaders);
        RequestBody requestBody = buildRequestBody();
        if (requestBody == null) {
            builder.get();
        } else {
            builder.post(requestBody);
        }

//        requestTime = System.currentTimeMillis();
        return builder.build();

    }

//    public void request(){
//        PostFormRequest.execute(RequestManager.okhttpClient,);
//
//    }


    public RequestParams getParama() {
        return parama;
    }

    public void setParama(RequestParams parama) {
        this.parama = parama;
    }


}
